<template>
  <div>
    <div class="right_item">
      <div class="tu">
        <img src="../../assets/images/图片检测.png" alt="" />
      </div>
      <div class="she">
        <img src="../../assets/images/zu.png" alt="" />
      </div>
    </div>

    <div class="right_di">
      <table>
        <thead>
          <tr>
            <td>序号</td>
            <td>设备名称</td>
            <td>设备状态</td>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(item, index) in datas" :key="index">
            <td>{{ item.ettg_serial }}</td>
            <td>{{ item.ettg_type }}</td>
            <td>
              <el-switch v-model="item.ettg_status" size="small" @change="huan" />
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import { getshe } from '../../request'

const datas = ref([])
onMounted(() => {
  getshe().then((res) => {
    console.log(res)
    datas.value = res.data.data.map((item, index) => {
      if (item.ettg_status == '开启') {
        item.ettg_status = true
      } else {
        item.ettg_status = false
      }
      return item
    })
  })
})
</script>


<style>
.right_item {
  margin-top: 10px;
  width: 100%;
  height: 150px;
  background: #0c1d5f;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.tu {
  width: 40% !important;
  height: 100%;
  text-align: center;
}
.tu img {
  width: 120px;
  height: 120px;
}
.she {
  flex: 1;
  color: #fff;
}
.she img {
  width: 220px;
}
.right_di {
  height: 260px;
  margin-top: 12px;
  background: #0c1d5f;
  /* background-color: red; */
  color: #fff;
  overflow: auto;
  scrollbar-width: none;
}
.right_di table {
  border: 1px solid #eee;
  border-collapse: collapse;
}
.right_di td {
  width: 152px;
  height: 30px;
  text-align: center;
  border: 1px solid #ccc;
}
</style>